﻿using System;
using System.Collections.Generic;
using System.Linq;
using DLM.Domain.Model;
using DLM.Domain.Repositories;
using DLM.Infrastructure.UnitOfWork;
using DLM.Infrastructure.Domain;
using Webdiyer.WebControls.Mvc;

namespace DLM.Data.EF.CodeFirst.Repositories
{
    public class SupplierRepository : Repository<Supplier, int>, ISupplierRepository
    {
        public SupplierRepository(IUnitOfWork unitOfWork)
            : base(unitOfWork)
        { }

        public override IEnumerable<Supplier> FindAll(System.Linq.Expressions.Expression<Func<Supplier, bool>> query, int index, int count)
        {
       
            return this.ActiveContext.Supplier.AsNoTracking().Where(query).OrderByDescending(s => s.CreateDate).ToPagedList(index, count);
        }
    }
}
